package com.chicken.swagger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import com.mangofactory.swagger.configuration.SpringSwaggerConfig;
import com.mangofactory.swagger.models.dto.ApiInfo;
import com.mangofactory.swagger.plugin.EnableSwagger;
import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin;

@EnableSwagger
@EnableWebMvc  
@Component
@ComponentScan("com.chicken.controller")  
public class SwaggerConfig {

	private SpringSwaggerConfig springSwaggerConfig;  
	  
    /** 
     * Required to autowire SpringSwaggerConfig 
     */  
    @Autowired  
    public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig)  
    {  
        this.springSwaggerConfig = springSwaggerConfig;  
    }  
  
    /** 
     * Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc 
     * framework - allowing for multiple swagger groups i.e. same code base 
     * multiple swagger resource listings. 
     */  
    @Bean  
    public SwaggerSpringMvcPlugin customImplementation(){
    	  return new SwaggerSpringMvcPlugin(this.springSwaggerConfig)
    	        .apiInfo(apiInfo())
    	        .includePatterns(".*?");
    	}

	public ApiInfo apiInfo() {
		ApiInfo apiInfo1 = new ApiInfo(
				// 标题
				"慧养鸡会员管理系统",
				// 描述
				"WEB API文档",
				// 服务条款
				"sadasd",
				// 邮箱
				"feixingyuanup@gmail.com",
				// 许可类型
				"sdasdasd",
				// 许可网站
				"localhost:8080/chicken_house_member/member/show");
		return apiInfo1;
	}
}
